import yFree from './YFree/YFree.js'

let _prefix = "ADMIN_";

export default {
    IFinal: {
        toastTitle: "欢迎使用YShop管理后台",
        aesPwd: "000000000000",
        Page: {
            index: "index",
            home: "home",
        },
        SaveKey: {
            menuModels_history: "menuModels_history",
        },
    },
    AppUtils: {
        userModel: "userModel",
        saveUserModel: function (userModel) {
            yFree.ySaveObj(this.userModel, userModel);
        },
        readUserModel: function () {
            let userModel = yFree.yReadObj(this.userModel);
            if (userModel == null) return null;
            if (new Date().getTime() - userModel.login_time > 1000 * 60 * 60 * 24) { // 最后登录时间超过24个小时
                this.deleteUserModel();
                return null;
            }
            return userModel;
        },
        deleteUserModel: function () {
            yFree.yDelete(this.userModel);
        },
    },
    IJkid: {
        //系统
        checkLine: `${_prefix}00A01`, //线路心跳

        //用户
        refresh_sign: `${_prefix}01A00`, //刷新sign
        login: `${_prefix}01A01`, //登录

        //商品管理
        spu_list: `${_prefix}02A01`, //分页获取商品列表
        spu_addOrEdit: `${_prefix}02A02`, //新增/编辑SPU
        spu_delete: `${_prefix}02A03`, //删除SPU
    },
};
